﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _2302MVCDemo.Controllers
{
    public class RegisterController : Controller
    {
        // GET: Register
        public ActionResult Index()
        {
            ViewBag.datetime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            return View();
        }

        [HttpPost]
        public ActionResult Add(string name,string pwd1,string pwd2)
        {

            return View("Index");
        }

        public ActionResult Check(string name)
        {
            ViewBag.datetime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            if (name == "admin")
            {
                ViewBag.tip = "admin用户已注册！";
            }
            else
            {
                ViewBag.tip = "该用户可注册！";
            }
            return View("Index");
        }

        public ActionResult AjaxCheck(string name)
        {
            ViewBag.datetime = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss");
            if (name == "admin")
            {
                return Content("admin用户已注册！");
            }
            else
            {
                return Content("该用户可注册！");
            }
        }
    }
}